<extend name="Public/base" />
<!-- 管理员用户组新增和编辑页面 -->
<block name="body">
	<div class="main-title">
		<h2>编辑用户</h2>
	</div>

    <form action="{:U('User/edit')}" enctype="application/x-www-form-urlencoded" method="POST"
            class="form-horizontal">
        <div class="form-item">
            <label class="item-label">昵称</label>
            <div class="controls">
                <input type="text" class="text input-large" value="{$member.nickname}" style="background: #f0f0f0;" disabled/>
            </div>
        </div>
        <div class="form-item">
            <label for="adminValidDate" class="item-label">管理员有效日期</label>
            <div class="controls">
                <input id="adminValidDate" type="datetime" name="adminValidDate" class="text input-medium date" placeholder="请选择日期" value="{$member.adminValidDate|time_format='Y-m-d'}"/>
            </div>
        </div>
        <!--<div class="form-item">
            <label for="blcUserId" class="item-label">关联会员ID</label>
            <div class="controls">
                <input id="blcUserId" type="number" name="blcUserId" class="text input-large" value="{$member.blcUserId}"/>
            </div>
        </div>-->
        <div class="form-item">
            <label for="reclaimValidDate" class="item-label">回收权有效日期</label>
            <div class="controls">
                <input id="reclaimValidDate" type="datetime" name="reclaimValidDate" class="text input-medium date" placeholder="请选择日期" value="{$member.reclaimValidDate|time_format='Y-m-d'}"/>
            </div>
        </div>
        <div class="form-item">
            <label for="enableReclaimScore" class="item-label">可回收积分</label>
            <div class="controls">
                <input id="enableReclaimScore" type="number" name="enableReclaimScore" class="text input-large" value="{$member.enableReclaimScore}"/>
            </div>
        </div>
        <div class="form-item">
            <label for="remark" class="item-label">备注</label>
            <div class="controls">
                <label class="textarea input-large"><textarea id="remark" type="text" name="remark">{$member.remark}</textarea></label>
            </div>
        </div>
        <div class="form-item">
            <input type="hidden" name="uid" value="{$member.uid}" />
            <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" style="padding:10px 30px;" onclick="resetPwd({$member.uid});return false;">重置密码</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
<block>
<block name="script">
<script type="text/javascript" charset="utf-8">
    //导航高亮
$('.side-sub-menu').find('a[href="{:U('User/index')}"]').closest('li').addClass('current');
</script>

    <link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '
        <link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet"
              type="text/css">
        ';
    </php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript"
            src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}"
            charset="UTF-8"></script>
    <script type="text/javascript" src="__STATIC__/layer/layer.js"></script>

    <script type="text/javascript">
        $('#submit').click(function () {
            $('#form').submit();
        });

        $(function () {
            $('.time').datetimepicker({
                format: 'yyyy-mm-dd hh:ii',
                language: "zh-CN",
                minView: 0,
                autoclose: true
            });
            $('.date').datetimepicker({
                format: 'yyyy-mm-dd',
                language: "zh-CN",
                minView: 2,
                autoclose: true
            });
        });

        function resetPwd(uid) {
            layer.confirm('您确定要重置【{$member.nickname}】的密码吗？', {
                btn: ['确定','取消'],icon: 3 //按钮
            }, function(index){
                layer.close(index);
                $.post("{:U('resetPwd')}", {uid: uid}, function(data){
                    if(data == 1) {
                        layer.msg('密码已重置为123456', {icon: 6});
                    } else {
                        layer.msg('密码重置失败，请稍后再试', {icon: 5});
                    }
                });
            });
        }
    </script>
</block>
